package com.tanhua.dubbo.server.api;

import com.alibaba.dubbo.config.annotation.Service;
import com.tanhua.dubbo.server.pojo.Sound;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;

import java.util.List;

@Service
public class SoundApiImpl implements SoundApi{
    @Autowired
    private MongoTemplate mongoTemplate;

    /*保存语音*/
    @Override
    public String saveSound(Sound sound) {
        this.mongoTemplate.save(sound);
        return sound.getUserId().toString();
    }

    @Override
    public List<Sound> querySounds() {
        List<Sound> sounds = this.mongoTemplate.findAll(Sound.class);
        return sounds;
    }
}
